#include <iostream>
#include <queue>
using namespace std;

const int N = 200010;
int n, k;
long long a[N], b[N];

int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> b[i];
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        b[i] = -b[i];
    }
    priority_queue<pair<long long, long long>> pq;
    for (int i = 1; i <= n; i++)
        pq.push({ a[i],b[i] });

    long long res1 = 0, res2 = 0;
    while (k--)
    {
        auto t = pq.top();
        pq.pop();
        res1 += t.first;
        res2 += t.second;
    }
    res2 = -res2;
    cout << res2 << " " << res1;
    return 0;
}